
bigram_pos_words_original=word_ngram(pos_words_original,2,1); % 1 for review
bigram_neg_words_original=word_ngram(neg_words_original,2,1);
bigram_train_new_pos_words=word_ngram(new_pos_words,2,0); % 0 for vocabulary
bigram_train_new_neg_words=word_ngram(new_neg_words,2,0); % 0 for vocabulary

bigram_train_new_complete_words = unique([bigram_train_new_pos_words, bigram_train_new_neg_words]); %concat



bigram_features_pos_comments=zeros(size(bigram_pos_words_original,2),size(bigram_train_new_complete_words,2));
 %freq_array = zeros(1,size(bigram_new_complete_words,2));
 
 for i =1:size(bigram_pos_words_original,2)
     bigram_features_pos_comments(i,:) = bigram_features_pos_comments(i,:) + countmember(bigram_train_new_complete_words,bigram_pos_words_original{i});
 end


bigram_features_neg_comments=zeros(size(bigram_neg_words_original,2),size(bigram_train_new_complete_words,2));
%freq_array = zeros(1,size(bigram_new_complete_words,2));

for i =1:size(bigram_neg_words_original,2)    
    bigram_features_neg_comments(i,:) = bigram_features_neg_comments(i,:) + countmember(bigram_train_new_complete_words,bigram_neg_words_original{i});
end

%top_features = [bigram_features_pos_comments;bigram_features_neg_comments];
classes = [ones(size(bigram_features_pos_comments,1),1);zeros(size(bigram_features_neg_comments),1)];
top_features  = gainratio(bigram_features_pos_comments,bigram_features_neg_comments,500);
SVM(top_features,classes);